package com.zuowei.ycy.user.config;

import com.alibaba.fastjson.JSON;
import com.and.yzy.frame.config.UserInfoManger;
import com.and.yzy.frame.util.SPUtils;
import com.zuowei.ycy.user.domain.UserInfo;

/**
 * Created by Administrator on 2016/ic_02/27.
 * 用户管理类
 */
public class UserManger extends UserInfoManger {

  /*  *//**
     * 默认精度
     *//*
    public static final String DAFAULT_LNG="117.159644";
    *//**
     * 默认纬度
     *//*
    public static final String DAFAULT_LAT="39.098411";*/

    /**
     * 设置百度纬度

     * @param
     */
    public static void setBaiDuLat(String lat){

        SPUtils spUtils = new SPUtils("userConfig");
        spUtils.put("BaiDuLat", lat);
    }
    /**
     * 设置百度经度

     * @param
     */
    public static void setBaiDuLon(String lon){

        SPUtils spUtils = new SPUtils("userConfig");
        spUtils.put("BaiDuLon", lon);
    }


    /**
     * 得到百度纬度

     * @param
     */
    public static String getBaiDuLat(){

        SPUtils spUtils = new SPUtils("userConfig");
        return (String) spUtils.get("BaiDuLat","39.098411");
    }

    /**
     * 得到百度经度
     * @param
     */
    public static String getBaiDuLon(){

        SPUtils spUtils = new SPUtils("userConfig");
        return (String) spUtils.get("BaiDuLon","117.159644");
    }

    public static void setUserInfo(UserInfo userInfo){
        SPUtils spUtils = new SPUtils("userConfig");
        spUtils.put("userInfo", JSON.toJSONString(userInfo));
    }


    public static UserInfo getUserInfo(){
        SPUtils spUtils = new SPUtils("userConfig");
        String userdata = (String) spUtils.get("userInfo", "{}");
        return JSON.parseObject(userdata,UserInfo.class);
    }

    public static String getM_id(){

        if (getUserInfo()==null){
            return null;
        }
        return  getUserInfo().getM_id();
    }



}
